package com.wlscale.roadsystem.modular.setting;

import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.TimePickerView;
import com.easy.component.component.header.EasyHeaderBuilder;
import com.wlscale.roadsystem.R;
import com.wlscale.roadsystem.base.LZBaseActivity;
import com.wlscale.roadsystem.wiget.ChoiceTimeAlertDialog;

import java.util.Date;

/**
 * 停车数据管理
 */
public class ParkingDataManagementActivity extends LZBaseActivity implements View.OnClickListener {
    /**
     *
     */
    private EasyHeaderBuilder easyHeaderBuilder;
    /**
     * 开始时间
     */
    private TextView btn_start_date_picker_text_view;
    /**
     * 结束时间
     */
    private TextView btn_end_date_picker_text_view;
    /**
     * 导出时间
     */
    private Button btn_export_data;
    @Override
    public void initlayoutResID() {
        setContentView(R.layout.activity_data_manage);
    }

    @Override
    public void initBundle() {

    }

    @Override
    public void initView() {
        btn_start_date_picker_text_view = findViewById(R.id.btn_start_date_picker_text_view);
        btn_end_date_picker_text_view = findViewById(R.id.btn_end_date_picker_text_view);
        btn_export_data = findViewById(R.id.btn_export_data);
        btn_start_date_picker_text_view.setOnClickListener(this);
        btn_end_date_picker_text_view.setOnClickListener(this);
        btn_export_data.setOnClickListener(this);
    }

    @Override
    public void initHeader() {
        easyHeaderBuilder = new EasyHeaderBuilder(this);
        easyHeaderBuilder.addLeftImageBackView();
        easyHeaderBuilder.setTitle("数据管理");
        easyHeaderBuilder.addLeftImageBackListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishActivity();
            }
        });
    }

    @Override
    public void initLoadingView() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.btn_start_date_picker_text_view:
                choiceTime(true);
                break;
            case R.id.btn_end_date_picker_text_view:
                choiceTime(false);
                break;
            case R.id.btn_export_data:
                showChoiceTimeAlert("重整记录导出", "请选择需要导出的日期：", "导出", "取消", new ChoiceTimeAlertDialog.OnClickLister() {
                    @Override
                    public void onClickLister(String startTime, String endTime) {

                    }
                });
                break;
        }
    }

    /**
     * 选择时间
     * @param isStart
     */
    private void choiceTime(boolean isStart){
        TimePickerView pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date, View v) {//选中事件回调
            }
        }).build();
        pvTime.show();
    }
}
